Skip to content

fix: remove dead code and fix handling consistency#6

Merged
basgys merged 1 commit intomainfrom
fix/cleanup
Mar 15, 2026
Merged

fix: remove dead code and fix handling consistency#6
basgys merged 1 commit intomainfrom
fix/cleanup

Conversation

@basgys
Copy link
Copy Markdown
Contributor

@basgys basgys commented Mar 15, 2026

Summary

  • Dead code removed: adaptiveThrottleOptions.isErrorAccepted was
    set by WithAcceptedErrors but never transferred to the struct or
    consulted anywhere. Callers using this deprecated option got silently
    no-op behaviour. The field is removed; WithAcceptedErrors is now an
    explicit no-op with an updated deprecation notice.

  • Consistent errRejected handling: WithAdaptiveThrottle was
    rejecting before unwrapping the error, while Throttle and
    Throttle[T] unwrap first and then fall through to the reject step.
    WithAdaptiveThrottle now uses the same pattern. No behaviour change.

  • Doc typo fix: DefaultRejectedErrors (non-existent) corrected to
    IsRejectedError in the DefaultAcceptedErrors deprecation comment.


Note

Low Risk
Low risk: mainly removes unused/dead option plumbing and makes errRejected handling consistent; throttling behavior should remain unchanged except for clearer deprecation/no-op behavior.

Overview
Removes dead configuration around AdaptiveThrottleOption by dropping the unused isErrorAccepted field and making the deprecated WithAcceptedErrors an explicit no-op with updated deprecation guidance.

Aligns WithAdaptiveThrottle’s error classification with Throttle/Throttle[T] by unwrapping errRejected and then falling through to the standard IsRejectedError rejection path, and fixes a deprecation comment typo to reference IsRejectedError.

Written by Cursor Bugbot for commit 32160c4. This will update automatically on new commits. Configure here.

WithAcceptedErrors has been storing into opts.isErrorAccepted, a field
that is never read — making the option silently inert. Remove the dead
field and make WithAcceptedErrors an explicit no-op, updating its
deprecation notice to reflect this.

Align the errRejected switch case in WithAdaptiveThrottle to use the
same unwrap-then-fallthrough pattern already used in Throttle and
Throttle[T], removing a structural inconsistency with identical
observable behaviour.

Fix a typo in the DefaultAcceptedErrors deprecation comment:
DefaultRejectedErrors → IsRejectedErro
@basgys basgys merged commit 6dc1a78 into main Mar 15, 2026
2 checks passed
@basgys basgys deleted the fix/cleanup branch March 15, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant